# -*- coding:utf-8 -*-
# time: 2025/7/26 ♡  19:45
# author:张伟
from functools import wraps

from flask import g, redirect


def login_required(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        if hasattr(g, "user"):
            return func(*args, **kwargs)
        else:
            return redirect("/login/")

    return wrapper






